Generally caching of block device data at a relatively lower latency device provides phenomenal performance for both read and write input/output (“I/O”) operations. As a read cache, data is stored in the cache device until it is replaced with the new data. Until then, the data is read from the cache device for subsequent read I/O operations directed to the same data block. As a write cache, new data is written to the cache device, and the write I/O operation is informed completed. Later based on policy, the dirty data stored in the cache device is persisted to the underlying stable medium. In addition, the cache device can be a solid state device (“SSD”). When compared to a hard disk drive, SSD devices have superior read and write performance. It is therefore desirable to maximize use of the SSD device as the cache device to achieve a greater performance advantage.
Additionally, snapshot technologies are used to capture a point-in-time image of a data storage volume. In particular, a snapshot records the state of the data storage volume at a given time. The snapshot is preserved and then mounted, deleted and/or rolled back onto the data storage volume arbitrarily. Accordingly, snapshot technologies can be used in a number of applications including, but not limited to, data protection, security, backup and analysis. An example snapshot technology is re-direct-on-write (“ROW”). According to the ROW algorithm, when a new write I/O operation arrives at a logical block address (“LBA”) of the data storage volume at which data was written before the snapshot, it is re-directed and written to a new LBA of the snapshot volume. The data storage volume therefore contains the point-in-time data, i.e., the snapshot, and the snapshot volume contains the changed data. Another example snapshot technology is copy-on-write (“COW”). A snapshot taken using the COW algorithm is similar to one taken using the ROW algorithm, except that the COW algorithm imposes a double-write penalty. For example, when a new write I/O operation arrives at a LBA of the data storage volume at which data was written before the snapshot, the old data at the LBA of the data storage volume is copied and written to a new LBA of the snapshot volume before the old data at the LBA of the data storage volume is overwritten.
After creating a ROW snapshot or a COW snapshot, read-modify-write (“RMW”) operations are performed when sub-chunk-sized write I/O operations arrive at the data storage volume. For example, upon receiving a sub-chunk-sized write I/O operation, the following operations are performed: (1) old data for the entire chunk is read from the snapshot volume(s) (e.g., data stored at an old LBA), (2) the old data for the entire chunk is modified according to the write I/O operation and (3) the modified data for the entire chunk is written to the data storage volume (e.g., stored at a new LBA). In addition, when the SSD cache is controlled as a write cache, the RMW operation consumes more SSD cache space because the modified data for the entire chunk is stored in the SSD cache before being persisted to the underlying stable medium, which conflicts with the desire to maximize use of the SSD device as the cache device.